


CREATE TABLE [dbo].[LullabyReserva](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[IdLLibreCaixa] [int] NOT NULL,
	[CodiReserva] [varchar](50) NOT NULL,
	[IdTipusPagament] [int] NOT NULL,
	[Import] [float] NOT NULL,
 CONSTRAINT [PK_LullabyReserva] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[LullabyReserva]  WITH CHECK ADD  CONSTRAINT [FK_LullabyReserva_LullabyLLibreCaixa] FOREIGN KEY([IdLLibreCaixa])
REFERENCES [dbo].[LullabyLLibreCaixa] ([Id])
GO

ALTER TABLE [dbo].[LullabyReserva] CHECK CONSTRAINT [FK_LullabyReserva_LullabyLLibreCaixa]
GO


insert into LullabyReserva
	Select Id, '---- Cash', 0, TotalCash from LullabyLLibreCaixa where TotalCash <> 0
insert into LullabyReserva
	Select Id, '---- Tarjeta', 1, TotalTargeta from LullabyLLibreCaixa where TotalTargeta <> 0


alter table [LullabyLLibreCaixa] drop column TotalCash
GO
alter table [LullabyLLibreCaixa] drop column TotalTargeta
GO


